<template>
  <div class="assets over-bg">
    <div
      class="title text-t1 text-left text-18 person-bg bdb-borderBase text-bold"
    >
      {{ $t("assets.myAssets") }}
    </div>
    <div class="current-num mb-20 person-bg flex js-sp align-center">
      <div>
        <div class="text-18 text-left mb-10 text-bold">
          {{ $t("assets.currentTotalValuation") }}
          <i
            class="el-icon-view text-t1 text-18 point"
            @click="state.ishidden = !state.ishidden"
            style="margin-inline-start:16px"
          ></i>
        </div>
        <div class="text-left flex align-center">
          <div class="text-t1 text-bolder text-24">
            {{
              $currency(state.infos?.convert_total)
            }}
            BTC
          </div>
          <div>/</div>
          <div>
            {{
              $currency(state.infos?.convert_usd_total)
            }}
            USD
          </div>
        </div>
      </div>
      <div class="flex js-sp" v-if="!virtual_wallet">
        <router-link
          to="/addressmanage"
          class="huazhuan text-18 share-color person-btn radius flex js-sp align-center point"
        >
          <svg-icon
            data-_icon-name="ic_person_location"
            class="text-26 mr-6"
          ></svg-icon>
          {{ $t("assets.withdrawalAddressManagement") }}
        </router-link>
        <div
          class="huazhuan text-18 share-color person-btn radius flex js-sp align-center point"
          @click="onTransfer"
        >
          <img src="@/assets/images/huazhuang.png" alt />
          {{ $t("assets.fundTransfer") }}
        </div>
      </div>
    </div>
    <div class="tabs-div person-bg">
      <div
        class="tab-box textperson-t3  flex js-st align-center point bdb-borderBase"
      >
      
        <div
         v-for="(item,index) in state.tablist"
          v-if="state.wallet_transaction"
          class="tab text-14"
          @click="changeTab(item.id)"
          :class="{ 'textperson-t2 text-bold active-line': state.active === item.id }"
        >
        {{ item.name }}
          <!-- {{ $t("exchange.currency") }} -->
        </div>
        <!-- <div
          v-if="state.wallet_legal && !virtual_wallet"
          class="tab text-14"
          @click="changeTab(1)"
          :class="{ 'textperson-t2 text-bold active-line': state.active === 1 }"
        >
          {{ $t("stock.fiat") }}
        </div>
        <div
          v-if="state.wallet_lever"
          class="tab text-14"
          @click="changeTab(2)"
          :class="{ 'textperson-t2 text-bold active-line': state.active === 2 }"
        >
          {{ $t("exchange.lever") }}
        </div>
        <div
          v-if="state.wallet_second_lever"
          class="tab text-14"
          @click="changeTab(22)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 22,
          }"
        >
          {{ $t("newTheme.options") }}
        </div>

        <div
          v-if="state.wallet_stock"
          class="tab text-14"
          @click="changeTab(2007)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 2007,
          }"
        >
          {{ $t("stock.stock") }}
        </div>
        <div
          v-if="state.wallet_stock_lever"
          class="tab text-14"
          @click="changeTab(2013)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 2013,
          }"
        >
          {{ $t("stock.stockLever") }}
        </div>
        <div
          v-if="state.wallet_stock_second_lever"
          class="tab text-14"
          @click="changeTab(2015)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 2015,
          }"
        >
          {{ $t("stock.stockSecond") }}
        </div>

        <div
          v-if="state.wallet_forex"
          class="tab text-14"
          @click="changeTab(60002)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 60002,
          }"
        >
          {{ $t("foreign.forexAccount") }}
        </div>
        <div
          v-if="state.wallet_project && !virtual_wallet"
          class="tab text-14"
          @click="changeTab(31)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 31,
          }"
        >
          {{ $t("assets.financial") }}
        </div>
        <div
          v-if="state.wallet_nft && !virtual_wallet"
          class="tab text-14"
          @click="changeTab(53)"
          :class="{
            'textperson-t2 text-bold active-line': state.active === 53,
          }"
        >
          NFT
        </div> -->
      </div>
    </div>
    <div class="account person-bg">
      <!-- v-if="state.active === 0" -->
      <BibiAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        :status="bibiStatus"
        :todayProfit="todayProfit"
        :active="state.active"
        @showExchange="showExchange"
      />
      <!-- <FabiAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        v-if="state.active === 1"
      />
      <HeyueAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        :status="leverStatus"
        v-if="state.active === 2"
      />
      <MiaoheyueAcount
        :todayProfit="todayProfit"
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        :status="secondStatus"
        v-if="state.active === 22"
      />
      <WealthAcount
        @assetsAccount="assetsAccount"
        :ishosting="isHosting"
        :data="state.assetsData"
        v-if="state.active === 31"
      />
      <NFTAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        :status="NFTStatus"
        v-if="state.active === 53"
      />
      <GameAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        :status="NFTStatus"
        v-if="state.active === 3015"
      />
      <ForeignExchangeAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        :status="forexStatus"
        @onChangeVirtualWallet="onChangeVirtualWallet"
        v-if="state.active === 60002"
      />
      <StockthAcount
        @assetsAccount="assetsAccount"
        @assetsStockAccount="assetsStockAccount"
        :data="state.assetsData"
        v-if="state.active === 2007"
      />
      <StockLeverAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        v-if="state.active === 2013"
      />
      <StockSecondAcount
        @assetsAccount="assetsAccount"
        :data="state.assetsData"
        v-if="state.active === 2015"
      /> -->
    </div>

    <el-dialog
      :title="$t('assets.fundTransfer')"
      v-model="state.dialogHuazhuan"
      width="400px"
    >
      <Huazhuan
        :downplace="true"
        v-if="state.dialogHuazhuan"
        :type="state.active"
        @close="state.dialogHuazhuan = false"
        @getbalance="getassetsInfo(false)"
      />
    </el-dialog>

    <!-- 账单明细 -->
    <el-dialog
      :title="$t('assets.billingDetails')"
      v-model="state.dialogVisible"
      @close="detailClose"
      width="500px"
    >
      <div class="detail" v-if="state.dialogVisible">
        <div
          v-if="state.active === 1"
          class="flex aligin-center text-bold text-18 text-center text-regular mb-20 plr-20"
        >
          <div
            class=" w-100 flex-grow-1 radius point  p-8"
            :class="{ 'text-login active-bg': state.fiatActive === 1 }"
            @click="changeActive(1)"
          >
            {{ $t("fiat.fiatBalance") }}
          </div>
          <div
            class="w-100 flex-grow-1 radius point p-8"
            :class="{ 'text-login active-bg': state.fiatActive === 2 }"
            @click="changeActive(2)"
          >
            {{ $t("fiat.merchantBalance") }}
          </div>
        </div>
        <!-- v-if="state.active != 2007" -->
        <div class="item-box" id="item-div" v-if="state.stockActiveTab != 2">
          <div
            class="single bdb-borderBase mb-20"
            v-for="(item, index) in state.account"
            :key="index"
          >
            <div class="single-top text-left mb-10 flex js-sp">
              <div class="textperson-t2 text-14 text-bold">
                {{
                  item.financial_type === 1 ||
                  item.financial_type === 2 ||
                  item.financial_type === 22
                    ? walletType === 2 || walletType === 13
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 3
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 4
                    ? walletType === 3 || walletType === 14
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 5
                    ? $t("exchange.rechargeStatus")
                    : item.financial_type === 6
                    ? $t("exchange.withdrawMoney")
                    : item.financial_type === 7
                    ? $t("exchange.buyIn")
                    : item.financial_type === 8
                    ? $t("exchange.sellOut")
                    : item.financial_type === 9 || item.financial_type === 10
                    ? $t("exchange.makeUpTheDifference")
                    : item.financial_type === 11
                    ? $t("exchange.contractClose")
                    : item.financial_type === 12
                    ? $t("exchange.leverOrder")
                    : item.financial_type === 13
                    ? $t("exchange.leverAway")
                    : item.financial_type === 14
                    ? $t("exchange.airdrop")
                    : item.financial_type === 15
                    ? $t("freeMoney.SystemAdjust")
                    : item.financial_type === 16
                    ? $t("exchange.cashfail")
                    : item.financial_type === 17
                    ? $t("exchange.cancelOrder")
                    : item.financial_type === 18
                    ? $t("exchange.firstReward")
                    : item.financial_type === 19 ||
                      item.financial_type === 20 ||
                      item.financial_type === 21
                    ? $t("exchange.rebateReward")
                    : item.financial_type === 23
                    ? walletType === 4 || walletType === 15
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 24
                    ? $t("exchange.placeAnOrder")
                    : item.financial_type === 25
                    ? $t("exchange.secondLiquidation")
                    : item.financial_type === 26 ||
                      item.financial_type === 27 ||
                      item.financial_type === 28
                    ? $t("exchange.commissionReward")
                    : item.financial_type === 29
                    ? $t("exchange.cancelSecondOrder")
                    : item.financial_type === 30
                    ? $t("exchange.revokeWithdraw")
                    : item.financial_type === 31
                    ? walletType === 2 || walletType === 13
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 32
                    ? walletType === 5
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 33
                    ? $t("exchange.poolBuy")
                    : item.financial_type === 34
                    ? $t("exchange.poolSettlement")
                    : item.financial_type === 35 || item.financial_type === 100
                    ? isHosting
                      ? $t("hosting.ManagedBuy")
                      : $t("exchange.financialBuyIn")
                    : item.financial_type === 36 || item.financial_type === 102
                    ? isHosting
                      ? $t("hosting.CustodySettlement")
                      : $t("exchange.financialSettlement")
                    : item.financial_type === 37
                    ? $t("exchange.secondDistribution")
                    : item.financial_type === 38
                    ? $t("exchange.currencyDistribution")
                    : item.financial_type === 39
                    ? $t("exchange.financialDistribution")
                    : item.financial_type === 1003 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.buyIn")
                    : item.financial_type === 1004 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.sellOut")
                    : item.financial_type === 1006 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.cancelSellOrder")
                    : item.financial_type === 1001 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.issueOrderSell")
                    : item.financial_type === 1007 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.merchantDelIssueOrderSell")
                    : item.financial_type === 1008 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.merchantDelBuyOrder")
                    : item.financial_type === 1005 &&
                      state.fiatActive === 1 &&
                      walletType === 1
                    ? $t("fiat.merchantBuy")
                    : item.financial_type === 1005 &&
                      state.fiatActive === 2 &&
                      walletType === 1
                    ? $t("fiat.merchantBuy")
                    : item.financial_type === 1001 &&
                      state.fiatActive === 2 &&
                      walletType === 1
                    ? $t("fiat.issueOrderSell")
                    : item.financial_type === 1002 &&
                      state.fiatActive === 2 &&
                      walletType === 1
                    ? $t("fiat.merchantSell")
                    : item.financial_type === 1007 &&
                      state.fiatActive === 2 &&
                      walletType === 1
                    ? $t("fiat.merchantDelIssueOrderSell")
                    : item.financial_type === 1006 &&
                      state.fiatActive === 2 &&
                      walletType === 1
                    ? $t("fiat.cancelSellOrder")
                    : item.financial_type === 2007 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("exchange.transferOut")
                    : item.financial_type === 42 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("exchange.transferIn")
                    : item.financial_type === 44 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("stock.contractCopyRebate")
                    : item.financial_type === 45 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("stock.secondCopyRebate")
                    : item.financial_type === 46
                    ? item.amount > 0
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 47
                    ? $t("freeMoney.rechargeRebate")
                    : item.financial_type === 48
                    ? isHosting
                      ? $t("hosting.FreeHostingFee")
                      : $t("freeMoney.giveFreeMoney")
                    : item.financial_type === 49
                    ? $t("freeMoney.SystemAdjust")
                    : item.financial_type === 50
                    ? $t("freeMoney.giveFreeDefiMoney")
                    : item.financial_type === 51 && walletType === 5
                    ? $t("newCoin.Subscribe")
                    : item.financial_type === 52 && walletType === 5
                    ? $t("newCoin.SubscriptionSettlement")
                    : item.financial_type === 3001 && walletType === 5
                    ? $t("newCoin.stockSubscription")
                    : item.financial_type === 3002 && walletType === 5
                    ? $t("newCoin.stockSettlement")
                    : item.financial_type === 53
                    ? walletType === 2 || walletType === 13
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 54
                    ? walletType === 6
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 55
                    ? $t("NFT.BuyNFTs")
                    : item.financial_type === 56
                    ? $t("NFT.SellNFTs")
                    : item.financial_type === 80
                    ? $t("worldCup.quizWin")
                    : item.financial_type === 81
                    ? $t("worldCup.joinQuiz")
                    : item.financial_type === 90 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.newUserGift")
                    : item.financial_type === 91 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.EmailBindingGift")
                    : item.financial_type === 92 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.MobilePhoneGift")
                    : item.financial_type === 93 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.IdentityGift")
                    : item.financial_type === 94 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.GoogleGift")
                    : item.financial_type === 95 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.BindingAdrdressGift")
                    : item.financial_type === 96 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.nfirstChargeGift")
                    : item.financial_type === 97 &&
                      (walletType === 2 || walletType === 13)
                    ? $t("send.RechargeGift")
                    : item.financial_type === 101
                    ? $t("exchange.financialBuyIn")
                    : item.financial_type === 103
                    ? $t("exchange.financialSettlement")
                    : item.financial_type === 2007
                    ? walletType === 7 || walletType === 16
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 2008
                    ? walletType === 7 || walletType === 16
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 2009
                    ? $t("exchange.buyIn")
                    : item.financial_type === 2019
                    ? $t("exchange.sellOut")
                    : item.financial_type === 2020 ||
                      item.financial_type === 2012
                    ? $t("exchange.makeUpTheDifference")
                    : item.financial_type === 2010
                    ? $t("exchange.cancelOrder")
                    : item.financial_type === 2013
                    ? walletType === 8 || walletType === 17
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 2014
                    ? walletType === 8 || walletType === 17
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 2004
                    ? $t("exchange.stockContractOrder")
                    : item.financial_type === 2006
                    ? $t("exchange.stockContractClosing")
                    : item.financial_type === 2005
                    ? $t("exchange.stockContractCancel")
                    : item.financial_type === 2015
                    ? walletType === 9 || walletType === 18
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 2016
                    ? walletType === 9 || walletType === 18
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 2021
                    ? walletType === 7 || walletType === 16
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 2022
                    ? walletType === 7 || walletType === 16
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 2023
                    ? walletType === 7 || walletType === 16
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 2024
                    ? walletType === 7 || walletType === 16
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 2001
                    ? $t("exchange.StockOptionOrder")
                    : item.financial_type === 2003
                    ? $t("exchange.stockOptionSettlement")
                    : item.financial_type === 60001 &&
                      (walletType === 10 || walletType === 11)
                    ? $t("foreign.foreignOrderClose")
                    : item.financial_type === 60002
                    ? walletType === 10 || walletType === 11
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 60003
                    ? walletType === 10 || walletType === 11
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70001
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70002
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70003
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70004
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70005
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70006
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70007
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70008
                    ? walletType === 1
                      ? $t("exchange.transferOut")
                      : $t("exchange.transferIn")
                    : item.financial_type === 70009
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70010
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70011
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70012
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70013
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70014
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70015
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 70016
                    ? walletType === 1
                      ? $t("exchange.transferIn")
                      : $t("exchange.transferOut")
                    : item.financial_type === 80001 && walletType === 5
                    ? $t("loan.lockCollateral")
                    : item.financial_type === 80002 && walletType === 5
                    ? $t("loan.step4")
                    : item.financial_type === 80003 && walletType === 5
                    ? $t("loan.borrowCurrencyTransfer")
                    : item.financial_type === 80004 && walletType === 5
                    ? $t("loan.returnCurrency")
                    : ""
                }}
              </div>
              <!-- <div
                class="imitate radius text-10"
                v-if="virtual_wallet && walletType === 11"
              >
                {{ $t("foreign.demo") }}
              </div> -->
            </div>
            <ul class="single-line mb-6 flex js-sp textperson-t3 mb-6">
              <li class="text-12 text-left w_20">
                {{ $t("assets.Amount") }}
              </li>
              <li class="text-12">{{ $t("assets.status") }}</li>
              <li class="text-12 text-right w_33">{{ $t("assets.time") }}</li>
            </ul>
            <ul class="single-line flex js-sp textperson-t2">
              <li class="text-12 text-left flex align-center w_20">
                <div>
                  {{
                    dolt(reduceFix(item.after, item.before)) > 0
                      ? item.financial_type != 81
                        ? "+"
                        : "-"
                      : ""
                  }}{{ $currency(dolt(item.amount)) }}
                </div>
                <div>
                  {{
                    (item.financial_type === 48 ||
                      item.financial_type === 49 ||
                      item.financial_type === 35) &&
                    item.balance_type === 2
                      ? " (" +
                        (isHosting
                          ? $t("hosting.ManagedTrialMoney")
                          : $t("freeMoney.experienceGold")) +
                        ")"
                      : (item.financial_type === 49 ||
                          item.financial_type === 50 ||
                          item.financial_type === 33) &&
                        item.balance_type === 3
                      ? "(" + $t("freeMoney.experienceGoldDefi") + ")"
                      : ""
                  }}
                </div>
              </li>
              <li class="text-12">
                {{
                  item.financial_status
                    ? $t("assets.completed")
                    : $t("assets.undone")
                }}
              </li>
              <li class="text-12 text-right w_33">{{ item.create_time }}</li>
            </ul>
          </div>
          
          <Norecord v-if="state.account.length === 0" />
        </div>
        <div class="item-box" id="item-div" v-if="state.stockActiveTab === 2">
          <div
            class="single bdb-borderBase mb-20"
            v-for="(item, index) in state.stock"
            :key="index"
          >
            <div class="single-top text-left mb-10 flex js-sp">
              <div class="textperson-t2 text-14 text-bold">
                {{
                  // item.financial_type === 1
                  //   ? $t("exchange.transferIn")
                  //   : item.financial_type === 2
                  //   ? $t("exchange.transferOut")
                  item.direction === 1 && item.order_status == 2
                    ? $t("stock.stockBuy")
                    : item.direction === 2 &&
                      (item.order_status == 1 || item.order_status == 2)
                    ? $t("stock.stockSell")
                    : // : item.financial_type === 5
                    // ? $t("stock.stockBuySpread")
                    // : item.financial_type === 6
                    // ? $t("stock.stockSellSpread")
                    item.order_status == 3
                    ? $t("stock.stockCancel")
                    : ""
                }}
              </div>
            </div>
            <ul class="single-line mb-6 flex js-sp textperson-t3 mb-6">
              <li class="text-12 text-left w_20">{{ $t("stock.position") }}</li>
              <li class="text-12">{{ $t("assets.status") }}</li>
              <li class="text-12 text-right w_33">{{ $t("assets.time") }}</li>
            </ul>
            <ul class="single-line flex js-sp textperson-t2">
              <li class="text-12 text-left w_20">
                {{
                  (item.direction === 1 && item.order_status == 2) ||
                  item.order_status == 3
                    ? "+"
                    : "-"
                }}{{ $currency(dolt(item.order_amount)) }}
              </li>
              <li class="text-12">
                {{ $t("assets.completed") }}
              </li>
              <li class="text-12 text-right w_33">
                {{ getTimeZoneDate(item.create_time) }}
              </li>
            </ul>
          </div>
          <Norecord v-if="state.stock.length === 0" />
        </div>
        <div>
          <div class="text-right">
            <el-pagination
              class="is-ltr"
              background
              small
              :current-page="state.currentpage"
              :page-size="state.assetsParam.limit"
              @current-change="pageChange"
              layout="prev, pager, next"
              :total="state.total"
            ></el-pagination>
          </div>
        </div>
      </div>
    </el-dialog>
    <!-- 一键兑换 -->
    <el-dialog
      :title="$t('stock.OneClickExchange')"
      v-model="state.dialogExchange"
      width="500px"
      @close="state.dialogExchange = false"
    >
      <Exchange
        v-if="state.dialogExchange"
        @close="state.dialogExchange = false"
      />
    </el-dialog>
  </div>
</template>

<script>
import { computed, onMounted, reactive, nextTick, watch } from "vue";
import BibiAcount from "@/components/personModel/assets/acount-bibi.vue";
import NFTAcount from "@/components/personModel/assets/acount-nft.vue";
import GameAcount from "@/components/personModel/assets/acount-game.vue";
import ForeignExchangeAcount from "@/components/personModel/assets/acount-foreignExchangeAcount.vue";
import WealthAcount from "@/components/personModel/assets/acount-wealth.vue";
import StockthAcount from "@/components/personModel/assets/acount-stock.vue";
import FabiAcount from "@/components/personModel/assets/acount-fabi.vue";
import HeyueAcount from "@/components/personModel/assets/acount-heyue.vue";
import MiaoheyueAcount from "@/components/personModel/assets/acount-second.vue";
import StockLeverAcount from "@/components/personModel/assets/acount-stock-lever.vue";
import StockSecondAcount from "@/components/personModel/assets/acount-stock-second.vue";
import Huazhuan from "@/components/personModel/assets/huazhuan.vue";
import { userAssetsInfo, userAssetsPage,assetsList} from "@/api/assets";
import { stockOrderRecordPage } from "@/api/stock";
import {
  demostockOrderRecordPage,
  demouserAssetsPage,
  demouserAssetsInfo,
} from "@/api/demo";
import { getTimeZoneDate } from "@/utils/times.js";
import { useStore } from "vuex";
import { ElMessage } from "element-plus";
import Norecord from "@/components/noRecord/NoRecord.vue";
import { transferToNumber } from "@/utils/common";
import { useRoute, useRouter } from "vue-router";
import { reduceFix } from "@/utils/precisionMath";
import Exchange from "@/components/homeModel/exchange-box.vue";
import UseSystemSetting from "@/commonapi/useSystemSetting";

export default {
  components: {
    BibiAcount,
    FabiAcount,
    WealthAcount,
    HeyueAcount,
    MiaoheyueAcount,
    Huazhuan,
    Norecord,
    NFTAcount,
    StockthAcount,
    StockLeverAcount,
    StockSecondAcount,
    GameAcount,
    ForeignExchangeAcount,
    Exchange,
  },
  setup() {
    // 获取开关状态
    const { virtual_wallet, default_wallet } = UseSystemSetting();
    const state = reactive({
      active: 1,
      dialogHuazhuan: false,
      assetsData: {},
      dialogVisible: false,
      account: [],
      total: 0,
      loading: false,
      currentpage: 1,
      ishidden: false, //是否隐藏资产估值
      assetsParam: {
        limit: 10,
        page: 0,
        wallet_type: 2,
      },
      tablist:[],
      stockParam: {
        limit: 10,
        page: 0,
        type: 2, //0-全部，1-交易记录，2-账单明细
      },
      infos:{

      },
      stock: [],
      wallet_transaction: false,
      wallet_legal: false,
      wallet_lever: false,
      wallet_second_lever: false,
      wallet_project: false,
      wallet_stock: false,
      wallet_stock_lever: false,
      wallet_stock_second_lever: false,
      wallet_nft: false,
      wallet_forex: false,
      fiatActive: 1,
      stockActiveTab: 1,
      dialogExchange: false,
      imitate: false,
    });
    const $store = useStore();
    const $route = useRoute();
    const $router = useRouter();
    //传给划转组件的默认划转账户
    const nowActive = computed(() => {
      if (default_wallet.value) {
        if (default_wallet.value == 1) {
          if (state.active === 0) {
            return 1;
          } else {
            return state.active;
          }
        } else if (default_wallet.value == 2) {
          switch (state.active) {
            case 0:
              return 3;
            case 1:
              return 3;
            case 2:
              return 70001;
            case 22:
              return 70002;
            case 31:
              return 70007;
            case 53:
              return 70008;
            case 2007:
              return 70003;
            case 2013:
              return 70004;
            case 2015:
              return 70005;
            case 60002:
              return 70006;
            default:
              return 70001;
          }
        } else if (default_wallet.value == 3) {
          if (state.active === 2013 || state.active === 2015) {
            return state.active;
          } else {
            return 2021;
          }
        }
      } else {
        return state.active;
      }
      return state.active;
    });
    const walletType = computed(() => {
      switch (state.active) {
        case 0:
          if (virtual_wallet.value) {
            return 13;
          } else {
            return 2;
          }
        case 1:
          return 1;
        case 2:
          if (virtual_wallet.value) {
            return 14;
          } else {
            return 3;
          }
        case 22:
          if (virtual_wallet.value) {
            return 15;
          } else {
            return 4;
          }
        case 31:
          return 5;
        case 53:
          return 6;
        case 2007:
          if (virtual_wallet.value) {
            return 16;
          } else {
            return 7;
          }
        case 2013:
          if (virtual_wallet.value) {
            return 17;
          } else {
            return 8;
          }
        case 2015:
          if (virtual_wallet.value) {
            return 18;
          } else {
            return 9;
          }
        case 60002:
          if (virtual_wallet.value) {
            return 11;
          } else {
            return 10;
          }
        default:
          if (virtual_wallet.value) {
            return 13;
          } else {
            return 2;
          }
      }
    });
    watch(
      () => virtual_wallet.value,
      () => {
        getassetsInfo(true);
      }
    );
    //是否是托管1理财宝2托管
    const isHosting = computed(() => {
      let list = $store.state.user.systemInfo;
      let flag = false;
      list.forEach((ele) => {
        if (ele.key === "wealth_management_type") {
          if (ele.value === 2) {
            flag = true;
          }
        }
      });
      return flag;
    });
    const systemInfo = computed(() => {
      return $store.state.user.systemInfo;
    });
    const bibiStatus = computed(() => {
      let flag = false;
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "currency_transaction_status") {
          flag = ele.value;
        }
      });
      return flag;
    });
    const NFTStatus = computed(() => {
      let flag = false;
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "wallet_nft") {
          flag = ele.value;
        }
      });
      return flag;
    });
    const forexStatus = computed(() => {
      let flag = false;
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "wallet_forex") {
          flag = ele.value;
        }
      });
      return flag;
    });
    const onChangeVirtualWallet = (val) => {
      $store.dispatch("user/changeVirtualWallet", val).then(() => {
        $store.commit("exchange/SET_ACCOUNTTYPE", val ? 2 : 1);
      });
    };
    const leverStatus = computed(() => {
      let flag = false;
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "lever_status") {
          flag = ele.value;
        }
      });
      return flag;
    });
    const secondStatus = computed(() => {
      let flag = false;
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "second_lever_status") {
          flag = ele.value;
        }
      });
      return flag;
    });
    const todayProfit = computed(() => {
      let flag = false;
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "today_profit") {
          flag = ele.value;
        }
      });
      return flag;
    });
    /**
     * methods
     */
    onMounted(() => {
      console.log('ssssssssssssssssssss')
      assetsList().then(res=>{
        state.tablist=res.data.account_types
        state.infos=res.data
        console.log(state.tablist,'账号列表')
        
      })
      getassetsInfo(true);
      isShow();
    });
    const dolt = (val) => {
      return transferToNumber(val);
    };
    // 是否正数
    const isPositiveNumber = (num) => {
      return num >= 0;
    };
    // 判断显隐
    const isShow = () => {
      systemInfo.value?.forEach((ele) => {
        if (ele.key === "wallet_transaction") {
          state.wallet_transaction = ele.value;
        }
        if (ele.key === "wallet_legal") {
          state.wallet_legal = ele.value;
        }
        if (ele.key === "wallet_lever") {
          state.wallet_lever = ele.value;
        }
        if (ele.key === "wallet_second_lever") {
          state.wallet_second_lever = ele.value;
        }
        if (ele.key === "wallet_project") {
          state.wallet_project = ele.value;
        }
        if (ele.key === "wallet_stock") {
          state.wallet_stock = ele.value;
        }
        if (ele.key === "wallet_stock_lever") {
          state.wallet_stock_lever = ele.value;
        }
        if (ele.key === "wallet_stock_second_lever") {
          state.wallet_stock_second_lever = ele.value;
        }
        if (ele.key === "wallet_nft") {
          state.wallet_nft = ele.value;
        }
        if (ele.key === "wallet_forex") {
          state.wallet_forex = ele.value;
        }
      });
    };
    // 资产详情
    const getassetsInfo = (val) => {
      let setFun = virtual_wallet.value ? demouserAssetsInfo : userAssetsInfo;
      setFun(state.active)
        .then((res) => {
          if (res.data) {
            state.assetsData = res.data[0];
            console.log(state.assetsData,'资产详情')
            if (val) {
              nextTick(() => {
                if ($route.query.active) {
                  state.active = parseInt($route.query.active);
                } else {
                  state.active = 1;
                }
              });
            }
          }
        })
        .catch((err) => {
          ElMessage.error(err.message);
        });
    };
    // 账单明细
    const assetsAccount = (id) => {
      state.assetsParam.currency_id = id;
      state.assetsParam.wallet_type = walletType.value;
      if (walletType.value === 1 && state.fiatActive === 2) {
        state.assetsParam.tenant_status = true;
      } else {
        state.assetsParam.tenant_status = false;
      }
      let setFun = virtual_wallet.value ? demouserAssetsPage : userAssetsPage;
      setFun(state.assetsParam).then((res) => {
        state.dialogVisible = true;
        state.account = res.data.items;
        state.total = res.data.total;
      });
    };
    // 股票币种流水
    const assetsStockAccount = (val) => {
      state.stockParam.stock_id = val.id;
      state.stockActiveTab = val.active;
      let setFun = virtual_wallet.value
        ? demostockOrderRecordPage
        : stockOrderRecordPage;
      setFun(state.stockParam).then((res) => {
        state.dialogVisible = true;
        state.stock = res.data.items;
        state.total = res.data.total;
      });
    };
    // 分页
    const pageChange = (val) => {
      let itemBox = document.getElementById("item-div");
      itemBox.scrollTop = 0;
      if (state.active === 2007) {
        state.stockParam.page = val - 1;
        let obj = {
          id: state.stockParam.stock_id,
          active: 2,
        };
        assetsStockAccount(obj);
      } else {
        state.assetsParam.page = val - 1;
        assetsAccount(state.assetsParam.currency_id);
      }
    };
    const changeTab = (i) => {
      state.active = i;
      getassetsInfo()
    };
    const onTransfer = () => {
      state.dialogHuazhuan = true;
    };
    const changeActive = (i) => {
      state.fiatActive = i;
      state.assetsParam.page = 0;
      assetsAccount(state.assetsParam.currency_id);
    };
    const detailClose = () => {
      state.assetsParam.page = 0;
      state.stockParam.page = 0;
      state.stockActiveTab = 1;
      state.dialogVisible = false;
    };
    const showExchange = () => {
      if ($store.state.user.token) {
        state.dialogExchange = true;
      } else {
        $router.push(`/login?redirect=/person/myassets`);
      }
    };
    return {
      state,
      changeTab,
      onTransfer,
      getassetsInfo,
      assetsAccount,
      pageChange,
      walletType,
      systemInfo,
      isShow,
      transferToNumber,
      dolt,
      assetsStockAccount,
      getTimeZoneDate,
      detailClose,
      isPositiveNumber,
      bibiStatus,
      leverStatus,
      secondStatus,
      NFTStatus,
      isHosting,
      changeActive,
      todayProfit,
      reduceFix,
      showExchange,
      forexStatus,
      onChangeVirtualWallet,
      virtual_wallet,
      nowActive,
    };
  },
};
</script>

<style scoped lang="less">
.title {
  width: 100%;
  height: 65px;
  line-height: 65px;
  padding: 0 30px;
  font-family: PingFang SC;
  margin-bottom: 1px;
}
.current-num {
  width: 100%;
  height: 126px;
  padding: 30px;
  box-sizing: border-box;
}
.mb-10 {
  margin-bottom: 10px;
}
.mb-6 {
  margin-bottom: 6px;
}
.mr-6 {
  margin-inline-end: 6px;
}
.mb-20 {
  margin-bottom: 20px;
}
.tab-box {
  width: 100%;
  height: 48px;
  padding: 0 30px;
  box-sizing: border-box;
  // overflow-x: hidden;
  // overflow-y: scroll;
}
.tabs-div {
  overflow-y: hidden;
  overflow-x: scroll;
}
.tab {
  height: 100%;
  line-height: 48px;
  margin-inline-end: 30px;
  position: relative;
  white-space: nowrap;
}
.account {
  width: 100%;
}
.huazhuan {
  min-width: 148px;
  height: 42px;
  padding: 0 21px;
  box-sizing: border-box;
  margin-inline-start: 10px;
  img {
    width: 26px;
    height: 26px;
  }
}
.single {
  padding-bottom: 20px;
}
// .detail {
//   padding: 0 20px;
// }
.w_33 {
  width: 33%;
}
.w_20 {
  width: 20%;
}
.item-box {
  position: relative;
  max-height: 500px;
  overflow-y: scroll;
  padding: 0 20px;
  ::-webkit-scrollbar {
    opacity: 0.6;
  }
}
.item-box::-webkit-scrollbar-thumb {
  background: rgba(193, 193, 193, 0.1);
}
.active-bg {
  background: rgba(61, 103, 250, 0.1);
}
.p-8 {
  padding: 8px;
}
.plr-20 {
  padding: 0 20px;
}
.imitate {
  border: 1px solid #888888;
  color: #888888;
}
</style>
